<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	// 获得项目完全路径（假设你的项目叫MyApp，那么获得到的地址就是 http://localhost:8080/MyApp/）:    
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>主页</title>
<link href="css/index.css" rel="stylesheet" />
<link href="easyui/themes/default/easyui.css" rel="stylesheet" type="text/css" />
<link href="easyui/themes/icon.css" rel="stylesheet" type="text/css" />
<link href="css/demo.css" rel="stylesheet" />
<script src="easyui/jquery.min.js" type="text/javascript"></script>
<script src="easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="js/Default.js" type="text/javascript"></script>
</head>
<body>
	<noscript>
		<div
			style="position: absolute; z-index: 100000; height: 2046px; top: 0px; left: 0px; width: 100%; background: white; text-align: center;">
			<img src="images/noscript.gif" alt='抱歉，请开启脚本支持！' />
		</div>
	</noscript>
	<div data-options="region:'north',border:true"
		style="overflow: hidden; height: 70px; background: #338FCC; padding: 10px;">
		<div style="color: #fff; font-size: 3em; float: left; margin-left: 30px;">后台管理系统，欢迎您</div>
		<div style="float: right; position: relative; top: 20px; right: 0px; line-height: 40px;">
			<span id="managerinfo">您好, 梁继东</span> &nbsp;
			<a class="easyui-linkbutton" href="logout/mgr.do">注销</a>
			&nbsp;
			<a href="#" class="easyui-linkbutton" onclick="changepwd()">修改密码 </a>
		</div>
		<script type="text/javascript">
			var username;
			//获取管理员信息显示
			var managerInfo = $("#managerinfo");
			$.ajax({
				type : "POST",
				dataType : "json",
				url : "usr/info.do",
				success : function(data) {
					var status = data.status;
					if (status == 0) {//跳转到主页面
						username = data.body.loginName;
						var authority = data.body.authority;
						if (data.body.role == 0) {
							managerInfo.html("您好！  " + authority + ","
									+ username);
						} else {
							managerInfo.html("您好！  " + data.body.deptId + " "
									+ data.body.deptName + " " + username);
						}
					}
				},
				error : function() {
					$.messager.alert("提示", "系统出错返回登录界面", "warning", function() {
						window.location.href = "login.jsp";
					});
				}
			});
		</script>
	</div>
	<div data-options="region:'south',border:false"
		style="height: 30px; font-size: 12px; color: #fff; background: #338FCC; padding: 5px; text-align: center">
		© 2016 - 系统Test</div>
	<div data-options="region:'west',split:true,title:'菜单',collapsible:true"
		style="width: 190px; padding: 5px;">
		<div id="menu" class="easyui-accordion" fit="true">
			<div title="助管信息管理" style="overflow: auto; padding: 10px;" iconCls="icon-edit">
				<ul class="easyui-tree">
					<li>
						<a href="#" onclick="addTab('助管名额修改','./danwei.html')">助管名额修改</a>
					</li>
					<li>
						<a href="#" onclick="addTab('助管信息管理','./cur_assist_stu.html')">助管信息管理</a>
					</li>
				</ul>
			</div>
			<div title="学院账号管理" style="overflow: auto; padding: 10px;" iconCls="icon-edit">
				<ul class="easyui-tree">
					<li>
						<a href="#" onclick="addTab('账号管理','./secondy_user.html')">账号管理</a>
					</li>
					<li>
						<a href="#" href="Product/Default.htm">权限管理</a>
					</li>
				</ul>
			</div>
			<div title="补助信息管理" style="overflow: auto; padding: 10px;" iconCls="icon-edit">
				<ul class="easyui-tree">
					<li>
						<a href="#" href="Product/Default.htm">审核管理</a>
					</li>
					<li>
						<a href="#" href="Product/Default.htm">历史补助记录</a>
					</li>
				</ul>
			</div>
			<div title="助管补助信息管理" style="overflow: auto; padding: 10px;" iconCls="icon-edit">
				<ul class="easyui-tree">
					<li>
						<a href="#" onclick="addTab('本单位助管管理','./zhuguan.html')">本单位助管管理</a>
					</li>
					<li>
						<a href="#" onclick="addTab('上传助管补助信息','./buzhu_shangchuan.html')">上传助管补助信息</a>
					</li>
					<li>
						<div>
							<a href="#" onclick="addTab('已上传查询','./buzhu_current.html')">已上传查询</a>
						</div>
					</li>
				</ul>
			</div>
			<div title="学院账号管理" style="overflow: auto; padding: 10px;" iconCls="icon-edit">
				<ul>
					<li>
						<a href="#" onclick="addTab('账号管理','./secondy_user.html')">账号管理</a>
					</li>
				</ul>
			</div>
		</div>
	</div>
	<div region="center" id="mainPanle" style="overflow: hidden; padding: 2px;">
		<div id="tabs" class="easyui-tabs" fit="true" border="true">
			<div title="主页" style="padding: 20px;" id="home">
				<h1>欢迎...</h1>
			</div>
		</div>
	</div>

	<div id="dd" title="密码修改" style="width: 400px; height: 200px;">
		<table>
			<tr>
				<td>账 号:</td>
				<td><span id="pwd_username"></span></td>
			</tr>
			<tr>
				<td>旧密码:</td>
				<td><input id="old_pwd" type="password" /></td>
			</tr>
			<tr>
				<td>新密码:</td>
				<td><input id="new_pwd" type="password" /></td>
			</tr>
		</table>
	</div>
</body>
<script type="text/javascript">
	function changepwd() {
		//将用户名填上
		$("#pwd_username").html(username);
		$("#dd").dialog({
			modal : true,
			buttons : [ {
				text : '提交',
				iconCls : 'icon-ok',
				handler : putNewPwd
			} ]
		});
	}
	function putNewPwd() {
		//获取用户名，旧密码，新密码
		var old_pwd = $("#old_pwd").val();
		var new_pwd = $("#new_pwd").val();
		//alert(username + "," + old_pwd + "," + new_pwd);
		// 发出一个请求
		$.ajax({
			url : "usr/changepwd.do",
			cache : false,
			async : false,
			type : "POST",
			dataType : "json",
			data : {
				username : username,
				password : old_pwd,
				newPwd : new_pwd
			},
			success : function(result) {
				var status = result.status;
				if (status == 0) {
					$.messager.alert("提示", result.message, "info");
					$("#old_pwd").val("");
					$("#new_pwd").val("");
				} else {
					$.messager.alert("提示", result.message, "warning");
				}
			},
			error : function() {
				$.messager.alert("提示", "系统出错,请重试", "warning");
			}
		});
	}
</script>
</html>